<?php

class geo{

    public function  __construct() {
        include("includes/xml2array.php");
    }

    public function get($ip){
        $data=file_get_contents("http://www.playmanager.tk/geo/api.php?ip=".$ip);
        $data=xml2array($data);
        $data=$data['geo'];
        return($data);
    }

    public function show($toscan){

$data=$this->get($toscan);
?>
IP: <?php echo($toscan); ?><br />
<?php echo(LOC_COUNTRY); ?>: <?php echo($data['country']); ?> (<?php echo($data['country_attr']['code']); ?>)<br />
<?php echo(LOC_CITY); ?>: <?php if(!is_array($data['city'])){ echo($data['city']); } else { echo("Inconnue"); } ?><br />
<?php echo(LOC_REGION); ?>: <?php if(!is_array($data['region'])){ echo($data['region']); } else { echo(LOC_UNKNOWN); } ?><br />
<?php echo(LOC_GPS); ?>: <?php echo($data['latitude']); ?> , <?php echo($data['longitude']); ?><br />
<?php echo(LOC_CONTINENT); ?> <?php echo($data["continent"]); ?><br /><?php

    }

}

?>